// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
package sys

import (
	"context"
	"hotgo/addons/hgexample/api/admin/eprecycler"
	"hotgo/addons/hgexample/model/input/sysin"
	"hotgo/addons/hgexample/service"
)

var (
	EpRecycler = cEpRecycler{}
)

type cEpRecycler struct{}

// List 查看天使列表
func (c *cEpRecycler) List(ctx context.Context, req *eprecycler.ListReq) (res *eprecycler.ListRes, err error) {
	list, totalCount, err := service.SysEpRecycler().List(ctx, &req.EpRecyclerListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.EpRecyclerListModel{}
	}

	res = new(eprecycler.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出天使列表
func (c *cEpRecycler) Export(ctx context.Context, req *eprecycler.ExportReq) (res *eprecycler.ExportRes, err error) {
	err = service.SysEpRecycler().Export(ctx, &req.EpRecyclerListInp)
	return
}

// Edit 更新天使
func (c *cEpRecycler) Edit(ctx context.Context, req *eprecycler.EditReq) (res *eprecycler.EditRes, err error) {
	err = service.SysEpRecycler().Edit(ctx, &req.EpRecyclerEditInp)
	return
}

// View 获取指定天使信息
func (c *cEpRecycler) View(ctx context.Context, req *eprecycler.ViewReq) (res *eprecycler.ViewRes, err error) {
	data, err := service.SysEpRecycler().View(ctx, &req.EpRecyclerViewInp)
	if err != nil {
		return
	}

	res = new(eprecycler.ViewRes)
	res.EpRecyclerViewModel = data
	return
}

// Delete 删除天使
func (c *cEpRecycler) Delete(ctx context.Context, req *eprecycler.DeleteReq) (res *eprecycler.DeleteRes, err error) {
	err = service.SysEpRecycler().Delete(ctx, &req.EpRecyclerDeleteInp)
	return
}

// Status 更新天使状态
func (c *cEpRecycler) Status(ctx context.Context, req *eprecycler.StatusReq) (res *eprecycler.StatusRes, err error) {
	err = service.SysEpRecycler().Status(ctx, &req.EpRecyclerStatusInp)
	return
}